;;biohacker/trunk/network-debugger/presentation/demo-positive.lisp
(experiment 
 positive 
 (a b d) 
 :growth? t 
 :essential-compounds (a e))
#|
Focusing on experiment POSITIVE.
Experiment is consistent with model.
|#

(explain 'experiment-consistent)
#|
  1 (FOCUS-EXPERIMENT POSITIVE)    ()   Assumption
  2    (NUTRIENT A)               (1)  (:OR (NUTRIENT A) (:NOT (FOCUS-EXPERIMENT POSITIVE)))
  3 (COMPOUND-PRESENT A)          (2)  (:OR (COMPOUND-PRESENT A) (:NOT (NUTRIENT A)))
  4 ASSUME-UNKNOWNS-AS-CONVENIENT  ()   Assumption
  5 EXPERIMENT-GROWTH             (1)  (:OR EXPERIMENT-GROWTH (:NOT (FOCUS-EXPERIMENT POSITIVE)))
  6 (REACTION-REVERSIBLE R1)    (4 5)  (:OR (:NOT EXPERIMENT-GROWTH) (:NOT ASSUME-UNKNOWNS-AS-CONVENIENT) (REACTION-REVERSIBLE R1))
  7 SIMPLIFY-INVESTIGATIONS        ()   Assumption
  8    (GENE-ON G1)             (7 1)  (:OR (GENE-ON G1) (:NOT (FOCUS-EXPERIMENT POSITIVE)) (:NOT SIMPLIFY-INVESTIGATIONS))
  9 (:NOT (UNKNOWN-GENE-FOR E1))  NIL  (:OR (:NOT (UNKNOWN-GENE-FOR E1)))
 10 (ENZYME-PRESENT E1)         (8 9)  (:OR (UNKNOWN-GENE-FOR E1) (:NOT (GENE-ON G1)) (ENZYME-PRESENT E1))
 11 (REACTION-ENABLED R1)        (10)  (:OR (:NOT (ENZYME-PRESENT E1)) (REACTION-ENABLED R1))
 12    (NUTRIENT B)               (1)  (:OR (NUTRIENT B) (:NOT (FOCUS-EXPERIMENT POSITIVE)))
 13 (COMPOUND-PRESENT B)         (12)  (:OR (COMPOUND-PRESENT B) (:NOT (NUTRIENT B)))
 14 (COMPOUND-PRESENT G)  (6 3 11 13)  (:OR (:NOT (COMPOUND-PRESENT B)) (COMPOUND-PRESENT G) (:NOT (REACTION-ENABLED R1)) (:NOT (COMPOUND-PRESENT A)) (:NOT (REACTION-REVERSIBLE R1)))
 15    (NUTRIENT D)               (1)  (:OR (NUTRIENT D) (:NOT (FOCUS-EXPERIMENT POSITIVE)))
 16 (COMPOUND-PRESENT D)         (15)  (:OR (COMPOUND-PRESENT D) (:NOT (NUTRIENT D)))
 17   (GENE-ON G3P)             (7 1)  (:OR (GENE-ON G3P) (:NOT (FOCUS-EXPERIMENT POSITIVE)) (:NOT SIMPLIFY-INVESTIGATIONS))
 18    (GENE-ON G3)             (7 1)  (:OR (GENE-ON G3) (:NOT (FOCUS-EXPERIMENT POSITIVE)) (:NOT SIMPLIFY-INVESTIGATIONS))
 19 (:NOT (UNKNOWN-GENE-FOR E3))  NIL  (:OR (:NOT (UNKNOWN-GENE-FOR E3)))
 20 (ENZYME-PRESENT E3)    (17 18 19)  (:OR (UNKNOWN-GENE-FOR E3) (:NOT (GENE-ON G3)) (:NOT (GENE-ON G3P)) (ENZYME-PRESENT E3))
 21 (REACTION-ENABLED R3)        (20)  (:OR (:NOT (ENZYME-PRESENT E3)) (REACTION-ENABLED R3))
 22 (COMPOUND-PRESENT E)   (14 16 21)  (:OR (COMPOUND-PRESENT E) (:NOT (REACTION-ENABLED R3)) (:NOT (COMPOUND-PRESENT D)) (:NOT (COMPOUND-PRESENT G)))
 23          GROWTH          (1 3 22)  (:OR (:NOT (COMPOUND-PRESENT E)) (:NOT (COMPOUND-PRESENT A)) (:NOT (FOCUS-EXPERIMENT POSITIVE)) GROWTH)
 24 EXPERIMENT-CONSISTENT      (23 1)  (:OR (:NOT (FOCUS-EXPERIMENT POSITIVE)) (:NOT GROWTH) EXPERIMENT-CONSISTENT)
|#

(pp-facts (sort-facts (all-antecedents 'experiment-consistent)))
#|
(COMPOUND-PRESENT A)
(COMPOUND-PRESENT B)
(COMPOUND-PRESENT D)
(COMPOUND-PRESENT E)
(COMPOUND-PRESENT G)
(ENZYME-PRESENT E1)
(ENZYME-PRESENT E3)
(FOCUS-EXPERIMENT POSITIVE)
(GENE-ON G1)
(GENE-ON G3)
(GENE-ON G3P)
(NOT (UNKNOWN-GENE-FOR E1))
(NOT (UNKNOWN-GENE-FOR E3))
(NUTRIENT A)
(NUTRIENT B)
(NUTRIENT D)
(REACTION-ENABLED R1)
(REACTION-ENABLED R3)
(REACTION-REVERSIBLE R1)
ASSUME-UNKNOWNS-AS-CONVENIENT
EXPERIMENT-CONSISTENT
EXPERIMENT-GROWTH
GROWTH
SIMPLIFY-INVESTIGATIONS
|#

(all-antecedents 'experiment-consistent '((reaction-enabled ?r) (reaction-reversible ?r)))
;((REACTION-ENABLED R3) (REACTION-ENABLED R1) (REACTION-REVERSIBLE R1))

(explicit-reversibility)
;Reactions guessed to be reversible: (R1)
;(R1)
